<?php include(BASE_PATH . "/view/layout/admin.phtml"); ?>
<link rel="stylesheet" type="text/css" href="/css/common/city.css" />
<script type="text/javascript" src="/js/common/Popt.js"></script>
<script type="text/javascript" src="/js/common/cityJson.js"></script>
<script type="text/javascript" src="/js/common/citySet.js"></script>
<style>
.sideContent{padding: 60px;}
.header{height: 40px;background: #F2F2F2;padding-left: 20px;padding-top: 11px;}
.btn-cont{text-align: right;margin-bottom: 20px;}
._citys{width: 397px;}
.add-model{
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    display: none;
}
.add-zhe{
    position: absolute;
    background: rgba(0,0,0,0.3);
    height: 100%;
    width: 100%;
}
.add-input{
    position: absolute;
    left: 50%;
    top:10%;
    width: 520px;
    height: 350px;
    margin-left: -260px;
    z-index: 99;
    background: white;
    padding:20px;
    border-radius: 5px;
}

.input-group{
    margin: 40px auto;
}
.input-group input{
    border-radius: 3px;
    border: 1px solid #bfbfbf;
    color: gray;
    height: 32px;
    width: 320px;
    padding-left: 20px;
    position: relative;
    z-index: 2;
    background: rgba(255, 255, 255, 0);
}
.input-group input:hover{
    border: 1px solid;
}
.sfi{
    position: absolute;
    right: 10px;
    top: 3px;
    letter-spacing: 2px;
}
#textCity{
    cursor: pointer;
}
.add-btn-cont{
    text-align: center;
}
.add-btn-cont .btn{width: 75px;}
.w-1{width: 5%;}
.w-2{width: 20%;}
.w-3{width: 30%;}
.w-4{width: 10%;}
.table th,td{text-align: center;}
.input-group .mr20{
    width: 68px;
    display: inline-block;
    text-align: right;
}
</style>
<div class="header">
    <span>组织管理</span>
    <span>/</span>
    <span>价格管理</span>
</div>
<div class="sideContent">
    <div class="btn-cont">
        <button id="addSideBtn" type="button" class="btn btn-default">添加站点</button>
    </div>
    <table class="table table-bordered table-striped table-hover">
        <thead>
            <tr>
                <th class="w-1">编号</th>
                <th class="w-2">始发目的地</th>
                <th class="w-2">最终目的地</th>
                <th class="w-2">价格</th>
                <th class="w-2">创建时间</th>
                <th class="w-4">操作</th>
            </tr>
        </thead>
        <tbody>
        <?php foreach ($data['result'] as $rows) { ?>
            <tr>
                <td><?php echo $rows['id']; ?></td>
                <td><?php echo $rows['oldadress']; ?></td>
                <td><?php echo $rows['destination']; ?></td>
                <td><?php echo $rows['price']; ?>元</td>
                <td><?php echo $rows['insert_dt']; ?></td>
                <td>
                    <a>修改</a>
                    <span>&nbsp;</span>
                    <a>删除</a>
                </td>
            </tr>
            <?php }?>
        </tbody>
    </table>
    <nav style="text-align: center;">
        <?php echo $data['page'];?>
    </nav>
</div>
<div class="add-model">
    <div class="add-zhe"></div>
    <div class="add-input">
        <div class="input-group">
            <span class="mr20">始发目的地:</span>
            <input id="ycity" class="textCity" type="text" placeholder="请选择始发目的地" readonly="readonly">
            <span class="sfi">...</span>
        </div>
        <div class="input-group">
            <span class="mr20">最终目的地:</span>
            <input id="mcity" class="textCity" type="text" placeholder="请选择始最终目的地" readonly="readonly">
            <span class="sfi">...</span>
        </div>
        <div class="input-group">
            <span class="mr20">价格:</span>
            <input id="price" type="text" placeholder="请输入价格" maxlength="50">
        </div>
        <div class="add-btn-cont">
             <button id="sure" type="button" class="btn btn-primary mr50">确认</button>
             <button id="cancel" type="button" class="btn btn-default">取消</button>
        </div>
    </div>
</div>
<script>
$(function(){
    $(".textCity").click(function (e) {
        SelCity(this,e);
    });
    Side.init();
})

var Side = {
    init:function(){
        this.addEvent();
        this.saveEvent();
    },
    addEvent:function(){
        $("#addSideBtn").click(function(){
            $(".add-model").show();
        })
         $("#cancel").click(function(){
            $(".add-model").hide();
        })
    },
    saveEvent:function () {
        $("#sure").click(function () {
            var ycity = $("#ycity").val();
            var mcity = $("#mcity").val();
            var price = $("#price").val();
            $.ajax({
                type:"POST",
                url:"/application/price/save",
                datatype:"JSON",
                data:{"ycity":ycity,"mcity":mcity,"price":price,},
                success:function (ret) {
                    console.log(ret);
                },
                error:function (e) {
                    
                }
            })
        })
    }
}
</script>
<?php include(BASE_PATH . "/view/layout/adminFooter.phtml"); ?>